package com.woniu.micropropertyserver.mapper;

import com.woniu.micropropertyserver.bean.DeployTeIc;
import com.woniu.micropropertyserver.bean.DeployTenement;
import com.woniu.micropropertyserver.util.PageRest;
import org.apache.ibatis.annotations.*;

import java.util.Date;
import java.util.List;

/**
 * @author ：zhengbin
 * @date ：Created in 2021/1/28 0028
 * @description：
 * @modified By：
 * @version: $
 */
@Mapper
public interface TenementIcMapper {
   //未完

    int delInfo(Long[] ids);

    int updateAuth(@Param("ids") Long[] id, @Param("start") Date authorizeStartDate, @Param("end") Date authorizeEndDate,@Param("now") Date now);
    @Options(
            useGeneratedKeys = true,
            keyProperty = "t.id"
    )
    @Insert("insert into tenement_ic_check(IC_num,authorize_status,authorize_start_date,authorize_end_date,fk_owner_id) values(#{t.icNum},#{t.authorizeStatus},#{t.authorizeStartDate},#{t.authorizeEndDate},#{t.fkOwnerId})")
    int saveInfo(@Param("t") DeployTeIc check);

    int updateInfo(@Param("d") DeployTeIc check,@Param("now") Date now );

    List<DeployTeIc> findByParams(@Param("p") PageRest pageRest,@Param("t") DeployTeIc check);

    @Select("select t.id id, t.IC_num icNum, t.authorize_status authorizeStatus,t.authorize_start_date authorizeStartDate,t.authorize_end_date  authorizeEndDate ,o.item item, o.name name, o.phone phone, o.house_num houseNum from tenement_ic_check t, owner_info o where 1=1 and t.fk_owner_id=o.id and t.id =#{id}")
    DeployTeIc findById(long ids);
}
